package com.qdlc.p2p.common.enums;

import java.util.HashSet;
import java.util.Set;

/**
 * 卡片类型
 *
 * @author Kaiju Zhao
 * @version V1.0.0
 * @date 2016-05-07
 */
public enum EnumCardType {

    WINE_WIND_CARD(1, "“酒”酒卡"),
    PALM_WIND_CARD(2, "“掌”酒卡"),
    CABINET_WIND_CARD(3, "“柜”酒卡");

    int type;
    String name;

    EnumCardType(int type, String name) {
        this.type = type;
        this.name = name;
    }

    public static String getName(int type) {
        for (EnumCardType entry : EnumCardType.values()) {
            if (entry.type == type) {
                return entry.name;
            }
        }
        return "";
    }
    
    public static EnumCardType getCardType(int type){
    	for (EnumCardType entry : EnumCardType.values()) {
            if (entry.type == type) {
                return entry;
            }
        }
        return null;
    }
    
    public static Set<Integer> getWineCardSet(){
    	Set<Integer> set = new HashSet<Integer>();
    	set.add(WINE_WIND_CARD.type);
    	set.add(PALM_WIND_CARD.type);
    	set.add(CABINET_WIND_CARD.type);
    	return set;
    }

    public static EnumCardType getEnumCardType(int type) {
        for (EnumCardType entry : EnumCardType.values()) {
            if (entry.type == type) {
                return entry;
            }
        }
        return null;
    }

    public int getType() {
        return type;
    }

    public String getName() {
        return name;
    }

}
